﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace TimeService
{
    [MessageContract]
    public class GetTimeRequest
    {
        [MessageBodyMember]
        public string usuario { get; set; }
        [MessageBodyMember]
        public string geo { get; set; }
        [MessageBodyMember]
        public string cultura { get; set; }
    }
    [MessageContract]
    public class GetTimeResponse
    {
        [MessageBodyMember]
        public string time { get; set; }
    }


    [ServiceContract]
    public interface ITimeService
    {
        [OperationContract]
        GetTimeResponse GetTime(GetTimeRequest request);
    }
    [ServiceBehavior(InstanceContextMode= InstanceContextMode.PerCall)]
    public class TimeService : ITimeService
    {
        public TimeService()
        {
            Console.WriteLine("Creacion objeto at " + DateTime.Now.ToLongTimeString());  
        }
        public GetTimeResponse GetTime(GetTimeRequest request)
        {

            return  new GetTimeResponse(){ time=DateTime.Now.ToLongTimeString() };
        }
    }
}
